package com.wffz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wffz.comm.utils.DateUtils;
import com.wffz.mapper.NoticeMapper;
import com.wffz.po.Notice;
import com.wffz.po.ShareRecord;
import com.wffz.service.NoticeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author sunlei
 * @className NoticeServiceImpl
 * @Description
 * @date 2023-03-20 14:53
 **/
@Service
@Slf4j
public class NoticeServiceImpl implements NoticeService {

    @Resource
    private NoticeMapper mapper;

    @Override
    public List<Notice> queryNotice(Long userId) {
        QueryWrapper<Notice> wrapper = new QueryWrapper<>();
        wrapper.eq("status", "1");
        wrapper.notInSql("id","select notice_id from wffz_user_notice where user_id =  " + userId);
        List<Notice> list = mapper.selectList(wrapper);
        return list;
    }

    @Override
    public List<Notice> queryNoticeByType(String type) {
        QueryWrapper<Notice> wrapper = new QueryWrapper<>();
        wrapper.eq("status", "1");
        wrapper.eq("notice_type",type);
        List<Notice> list = mapper.selectList(wrapper);
        return list;
    }
}
